#include "stdafx.h"
#include "NPCManager.h"

NPCManager::NPCManager()
{
}
NPCManager::~NPCManager()
{

}
NPC* NPCManager::Add(NPCId id)
{
	NPC* pNPC = manager<NPC,NPCId>::Add(id);
	LOGGER_INFO("Add:%p,id:%d",pNPC,id);
	return pNPC;
}
bool NPCManager::Remove(NPCId id)
{
	if (id <= 0) return false;
	LOGGER_INFO("Remove,id:%d",id);
	return manager<NPC,NPCId>::Remove(id);
}
NPC* NPCManager::CreateFromNPCInfo(NPCInfo& info)
{
	Int32 nNPCId = GenerateIdInt32();
	NPC* pNPC = Add(nNPCId);
	if (pNPC == NULL)
	{
		LOGGER_ERROR("CreateFromNPCInfo,pNPC == NULL,nNPCId:%d",nNPCId);
		return NULL;
	}
	pNPC->SetNPCInfo(info);
	return pNPC;
}